<!DOCTYPE html>
<html >
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>申请纸质证书页</title>
		<link rel="stylesheet" type="text/css" href="../../css/mui.min.css">
		<!--<link rel="stylesheet" href="../../css/CFNetPP_Base.css">-->
		<link rel="stylesheet" type="text/css" href="../../css/base.css"/>
		<link rel="stylesheet" href="../../css/personal.css">
		<style type="text/css" media="screen">
			.base_right_item {
				color: white;
			}
			.left_aligned_input {
				text-align: left;
			}
			a:active {
				color: #d9d9d9;
			}
		</style>
	</head>
	<body class="base_gary_bg_color">
		<div class="base_style_color " id='BarAppearance' style="height: 22px;width: 100%"></div>
		<div class="base_navigation_bar base_style_color base_navigation_item_bar">
			<a class="base_left_item" href="#" onclick="ReturnKey()"> <img class="base_back_icon" src="../../image/icon_jiantou.png" alt=""> </a>
			<span>申请纸质证书</span>
			<a class="base_right_item" href="#" onclick="SubmitData()"> 提交 </a>
		</div>
		<div class="ApplyCertificate base_content_div base_content_font"  style="padding-top: 10px;">
			<form class="  mui-input-group">
				<div class="mui-input-row">
					<input id="name" class="left_aligned_input base_content_font base_dark_grey" type="text" placeholder="收件人姓名" >
				</div>
				<div class="mui-input-row">
					<input id="phonenumber" class="left_aligned_input base_content_font base_dark_grey"    onkeyup="this.value=this.value.replace(/\D/g,'')" type="tel" placeholder="联系电话" >
				</div>
				<div class="mui-input-row">
					<input id="address" class="left_aligned_input base_content_font base_dark_grey" type="text" placeholder="邮寄地址" id="address">
				</div>
				<div class="mui-input-row">
					<input  class="left_aligned_input base_content_font base_dark_grey"     type="text"  id="idcard_id" placeholder="请输入身份证号" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')" >
				</div>
			</form>
		</div>
	</body>
	<script type="text/javascript" src="../../script/jquery.min.js"></script>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/mui.min.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript" src="../../script/PayTreasurePay.js"></script>
	<script type="text/javascript" src="../../script/common.js"></script>
	<script type="text/javascript">
		var message;
		apiready = function() {
			message = '申请纸质证书'+'</br>'+api.pageParam.quarter_name;
			SendBehaviorTrajectoriesNotifi_Authentication('0', '申请纸质证书页', '128', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title, message);
			api.setScreenOrientation({
				orientation : 'portrait_up'
			});
		}
		function SubmitData() {
			var telScore = $('#phonenumber').val();
			var nameScore = $('#name').val();
			var addressScore = $('#address').val();
			var idcard = $('#idcard_id').val();
			var param = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjid'),
				quarter_id : api.pageParam.id, //开始答测验时间（时间戳）
				phone : telScore,
				address : addressScore,
				name : nameScore,
				idcard : idcard,
				message : message
			};
			if (telScore == '') {
				ShowToast('电话不能为空');
				return;
			}
			if (telScore.length != 11) {
				ShowToast('电话不正确');
				return;
			}
			if (nameScore == '' || nameScore.length <= 0) {
				ShowToast('姓名不能为空');
				return;
			}
			if (addressScore == '' || addressScore.length <= 0) {
				ShowToast('邮寄地址不能为空');
				return;
			}
			if (idcard == '' || idcard.length <= 0) {
				ShowToast('身份证号不能为空');
				return;
			}
			if (idcard.length != 18) {
				ShowToast('身份证号不正确');
				return;
			}
			cfnetppPOST(url_do_Get_Paper_Cert, param, false, function(data, status) {
				hideProgress();
				SendBusinessOperationsLogNotifi('申请纸质证书页', '128', param, param, '', data, '认证申请纸质证书接口', '128-01')
				if (status == 'success') {
					if (data.code == 200) {
						ispay();
					} else {
						api.toast({
							msg : '提交失败',
							duration : 2000,
							location : 'bottom'
						});
					}
				} else {
					api.toast({
						msg : '提交失败',
						duration : 2000,
						location : 'bottom'
					});
				}
			});
		}

		function sendNotifi() {
			api.sendEvent({
				name : 'ApplySuccess'
			});
		}

		function ReturnKey() {
			SendBehaviorTrajectoriesNotifi_Authentication('1', '申请纸质证书页', '128', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title, message);
			if (api.systemType == "ios") {
				api.closeWin({
				});
			} else {
				api.closeWin({
				});
			}
		}

		//是否支付
		function ispay() {
			var money = api.pageParam.certificate_money;
			if (money != null && money != 0) {
				$api.setStorage("jobs_id", api.pageParam.id);
				// 岗位id
				getOrderNumber(7,api.pageParam.id,3);
			} else {
				closewind();
			}
		}

		//关闭当前页面
		function closewind() {
			SendBehaviorTrajectoriesNotifi1('1', '申请纸质证书页', '128', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			sendNotifi();
			ShowToast('提交成功');
			api.closeWin({});
		}
	</script>
</html>
